package com.imooc.springboot.dubbo.nilinili.consumer.controller;


import com.imooc.springboot.dubbo.nilinili.res.CodeEnum;
import com.imooc.springboot.dubbo.nilinili.res.ResultFactory;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@CrossOrigin
@RequestMapping("/error")
public class ErrorController {

    @RequestMapping("/exthrow")
    public String error404(HttpServletRequest request) {
        return ResultFactory.createResult(CodeEnum.ERROR,request.getAttribute("errorMessage").toString());
    }
}
